// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
/* jshint esversion: 6 */
import Vue from 'vue';
import App from './App';
import router from './router';
import ElementUI from 'element-ui';

import store from './store';
import hoverCss from 'hover.css'//hovercss
import anime from 'animejs'//anime库
import vueLazyload from 'vue-lazyload';
import mavonEditor from 'mavon-editor';//makedown编辑器
import VueMarkdown from 'vue-markdown';//makedown转h5
import hljs from 'highlight.js';//代码高亮
import md5 from 'js-md5';
// import VueHighlightJS from 'vue-highlightjs'
import Friendly from './helpers/friendly'

import 'highlight.js/styles/github.css'
import 'highlight.js/styles/tomorrow-night.css'
import 'element-ui/lib/theme-chalk/index.css';
import 'mavon-editor/dist/css/index.css'
import Share from 'vue-social-share'
import 'vue-social-share/dist/client.css';
import VueJsonp from 'vue-jsonp'

import { config } from '../static/config'

Vue.prototype.$config = config;

Vue.use(Share)
Vue.use(mavonEditor)

Vue.use(Friendly)
Vue.use(VueJsonp)
Vue.use(anime)
Vue.use(hoverCss)//hoverCss useage:'hvr-xxx' http://ianlunn.github.io/Hover/
Vue.use(ElementUI);
Vue.use(VueMarkdown);
Vue.use(hljs);

Vue.prototype.$md5 = md5;
let pcShow = true
let w = document.documentElement.offsetWidth || document.body.offsetWidth;
if (w < 1000) {
    pcShow = false;
}
Vue.prototype.$pcShow = pcShow;

Vue.config.productionTip = false;

Vue.directive('highlight', function (el) {
    let blocks = el.querySelectorAll('pre code');
    setTimeout(() => {
        blocks.forEach((block) => {
            hljs.highlightBlock(block)
        })
    }, 200)
})

// 图片在assets文件夹，就需要使用require（）进行引入。
Vue.use(vueLazyload, {
    error: require('./assets/img/404.gif'),
    loading: require('./assets/img/lazy.gif')
})
// 图片在static文件夹，就可以直接写路径了

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    store,
    components: { App },
    template: '<App/>'
});
